/*
origin glsl source: 
#define CC_DEVICE_SUPPORT_FLOAT_TEXTURE 0
#define CC_ENABLE_CLUSTERED_LIGHT_CULLING 0
#define CC_DEVICE_MAX_VERTEX_UNIFORM_VECTORS 4096
#define CC_DEVICE_MAX_FRAGMENT_UNIFORM_VECTORS 1024
#define CC_DEVICE_CAN_BENEFIT_FROM_INPUT_ATTACHMENT 0
#define CC_PLATFORM_ANDROID_AND_WEBGL 0
#define CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES 0
#define CC_JOINT_UNIFORM_CAPACITY 256
#define CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS 56
#define CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS 1
#define USE_LOCAL 0
#define SAMPLE_FROM_RT 0
#define USE_PIXEL_ALIGNMENT 0
#define CC_USE_EMBEDDED_ALPHA 0
#define USE_ALPHA_TEST 0
#define USE_TEXTURE 1
#define IS_GRAY 0

precision highp float;
uniform highp mat4 cc_matView;
  uniform highp mat4 cc_matProj;
  uniform highp mat4 cc_matViewProj;
  uniform highp vec4 cc_cameraPos;
#if USE_LOCAL
  uniform highp mat4 cc_matWorld;
#endif
#if SAMPLE_FROM_RT
  #define QUATER_PI         0.78539816340
  #define HALF_PI           1.57079632679
  #define PI                3.14159265359
  #define PI2               6.28318530718
  #define PI4               12.5663706144
  #define INV_QUATER_PI     1.27323954474
  #define INV_HALF_PI       0.63661977237
  #define INV_PI            0.31830988618
  #define INV_PI2           0.15915494309
  #define INV_PI4           0.07957747155
  #define EPSILON           1e-6
  #define EPSILON_LOWP      1e-4
  #define LOG2              1.442695
  #define EXP_VALUE         2.71828183
  #define FP_MAX            65504.0
  #define FP_SCALE          0.0009765625
  #define FP_SCALE_INV      1024.0
  #define GRAY_VECTOR       vec3(0.299, 0.587, 0.114)
      #define LIGHT_MAP_TYPE_DISABLED 0
  #define LIGHT_MAP_TYPE_ALL_IN_ONE 1
  #define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2
  #define REFLECTION_PROBE_TYPE_NONE 0
  #define REFLECTION_PROBE_TYPE_CUBE 1
  #define REFLECTION_PROBE_TYPE_PLANAR 2
  #define REFLECTION_PROBE_TYPE_BLEND 3
  #define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4
      #define LIGHT_TYPE_DIRECTIONAL 0.0
  #define LIGHT_TYPE_SPHERE 1.0
  #define LIGHT_TYPE_SPOT 2.0
  #define LIGHT_TYPE_POINT 3.0
  #define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0
  #define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)
  #define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)
  #define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)
  #define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)
  #define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)
  #define TONE_MAPPING_ACES 0
  #define TONE_MAPPING_LINEAR 1
  #define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0
  #ifndef CC_SURFACES_DEBUG_VIEW_SINGLE
    #define CC_SURFACES_DEBUG_VIEW_SINGLE 1
  #endif
  #ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC
    #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2
  #endif
#endif
attribute vec3 a_position;
attribute vec2 a_texCoord;
attribute vec4 a_color;
varying vec4 color;
varying vec2 uv0;
vec4 vert () {
  vec4 pos = vec4(a_position, 1);
  #if USE_LOCAL
    pos = cc_matWorld * pos;
  #endif
  #if USE_PIXEL_ALIGNMENT
    pos = cc_matView * pos;
    pos.xyz = floor(pos.xyz);
    pos = cc_matProj * pos;
  #else
    pos = cc_matViewProj * pos;
  #endif
  uv0 = a_texCoord;
  #if SAMPLE_FROM_RT
    uv0 = cc_cameraPos.w > 1.0 ? vec2(uv0.x, 1.0 - uv0.y) : uv0;
  #endif
  color = a_color;
  return pos;
}
void main() { gl_Position = vert(); }
*/
export let glsl_93de2a4e557b6029f3dc81be13de039d = `#define IS_GRAY 0
#define USE_TEXTURE 1
#define USE_ALPHA_TEST 0
#define CC_USE_EMBEDDED_ALPHA 0
#define USE_PIXEL_ALIGNMENT 0
#define SAMPLE_FROM_RT 0
#define USE_LOCAL 0
#define CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS 1
#define CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS 56
#define CC_JOINT_UNIFORM_CAPACITY 256
#define CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES 0
#define CC_PLATFORM_ANDROID_AND_WEBGL 0
#define CC_DEVICE_CAN_BENEFIT_FROM_INPUT_ATTACHMENT 0
#define CC_DEVICE_MAX_FRAGMENT_UNIFORM_VECTORS 1024
#define CC_DEVICE_MAX_VERTEX_UNIFORM_VECTORS 4096
#define CC_ENABLE_CLUSTERED_LIGHT_CULLING 0
#define CC_DEVICE_SUPPORT_FLOAT_TEXTURE 0

precision highp float;
uniform highp mat4 cc_matView;
  uniform highp mat4 cc_matProj;
  uniform highp mat4 cc_matViewProj;
  uniform highp vec4 cc_cameraPos;
attribute vec3 a_position;
attribute vec2 a_texCoord;
attribute vec4 a_color;
varying vec4 color;
varying vec2 uv0;
vec4 vert () {
  vec4 pos = vec4(a_position, 1);
    pos = cc_matViewProj * pos;
  uv0 = a_texCoord;
  color = a_color;
  return pos;
}
void main() { gl_Position = vert(); }
`
import {
    vec4_V3_N,
    sampler2D,
    samplerCube,
    float,
    float_N,
    bool,
    bool_N,
    int_N,
    int,
    vec4,
    vec3,
    vec2,
    mat2,
    mat3,
    mat4,
} from "../builtin/BuiltinFunc"
import { glSet_V4_V4, glSet_V2_V2, glMul_M4_V4, getValueKeyByIndex, getOutValueKeyByIndex } from "../builtin/BuiltinOperator"
import {
    gl_FragData,
    gl_FragColor,
    gl_Position,
    gl_PointSize,
    gl_FragCoord,
    gl_FragDepth,
    gl_FrontFacing,
    custom_isDiscard,
} from "../builtin/BuiltinVar"
import { cpuRenderingContext } from "../../CpuRenderingContext"
import {
    AttributeData,
    FragShaderHandle,
    UniformData,
    VaryingData,
    ShaderLocalData,
    VertShaderHandle,
    StructData,
} from "../../ShaderDefine"
import {
    IntData,
    FloatData,
    Vec2Data,
    Vec3Data,
    Vec4Data,
    Mat2Data,
    Mat3Data,
    Mat4Data,
    BoolData,
    Sampler2D,
    SamplerCube,
} from "../builtin/BuiltinData"
let CC_DEVICE_SUPPORT_FLOAT_TEXTURE = new FloatData(0)
let CC_ENABLE_CLUSTERED_LIGHT_CULLING = new FloatData(0)
let CC_DEVICE_MAX_VERTEX_UNIFORM_VECTORS = new FloatData(4096)
let CC_DEVICE_MAX_FRAGMENT_UNIFORM_VECTORS = new FloatData(1024)
let CC_DEVICE_CAN_BENEFIT_FROM_INPUT_ATTACHMENT = new FloatData(0)
let CC_PLATFORM_ANDROID_AND_WEBGL = new FloatData(0)
let CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES = new FloatData(0)
let CC_JOINT_UNIFORM_CAPACITY = new FloatData(256)
let CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS = new FloatData(56)
let CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS = new FloatData(1)
let USE_LOCAL = new FloatData(0)
let SAMPLE_FROM_RT = new FloatData(0)
let USE_PIXEL_ALIGNMENT = new FloatData(0)
let CC_USE_EMBEDDED_ALPHA = new FloatData(0)
let USE_ALPHA_TEST = new FloatData(0)
let USE_TEXTURE = new FloatData(1)
let IS_GRAY = new FloatData(0)
class AttributeDataImpl implements AttributeData {
    a_position: Vec3Data = new Vec3Data()
    a_texCoord: Vec2Data = new Vec2Data()
    a_color: Vec4Data = new Vec4Data()
    dataKeys: Map<string, any> = new Map([
        ["a_position", cpuRenderingContext.cachGameGl.FLOAT_VEC3],
        ["a_texCoord", cpuRenderingContext.cachGameGl.FLOAT_VEC2],
        ["a_color", cpuRenderingContext.cachGameGl.FLOAT_VEC4],
    ])
    dataSize: Map<string, number> = new Map([
        ["a_position", 1],
        ["a_texCoord", 1],
        ["a_color", 1],
    ])
}
class VaryingDataImpl extends VaryingData {
    color: Vec4Data = new Vec4Data()
    uv0: Vec2Data = new Vec2Data()

    factoryCreate() {
        return new VaryingDataImpl()
    }
    dataKeys: Map<string, any> = new Map([
        ["color", cpuRenderingContext.cachGameGl.FLOAT_VEC4],
        ["uv0", cpuRenderingContext.cachGameGl.FLOAT_VEC2],
    ])
    copy(varying: VaryingDataImpl) {
        glSet_V4_V4(varying.color, this.color)
        glSet_V2_V2(varying.uv0, this.uv0)
    }
}
class UniformDataImpl implements UniformData {
    cc_matView: Mat4Data = new Mat4Data()
    cc_matProj: Mat4Data = new Mat4Data()
    cc_matViewProj: Mat4Data = new Mat4Data()
    cc_cameraPos: Vec4Data = new Vec4Data()
    dataKeys: Map<string, any> = new Map([
        ["cc_matView", cpuRenderingContext.cachGameGl.FLOAT_MAT4],
        ["cc_matProj", cpuRenderingContext.cachGameGl.FLOAT_MAT4],
        ["cc_matViewProj", cpuRenderingContext.cachGameGl.FLOAT_MAT4],
        ["cc_cameraPos", cpuRenderingContext.cachGameGl.FLOAT_VEC4],
    ])
    dataSize: Map<string, number> = new Map([
        ["cc_matView", 1],
        ["cc_matProj", 1],
        ["cc_matViewProj", 1],
        ["cc_cameraPos", 1],
    ])
}
class ShaderLocalDataImpl implements ShaderLocalData {
    dataKeys: Map<string, any> = new Map([])
    dataSize: Map<string, number> = new Map([])
    init() {}
}
export class Impl_93de2a4e557b6029f3dc81be13de039d extends VertShaderHandle {
    varyingData: VaryingDataImpl = new VaryingDataImpl()
    uniformData: UniformDataImpl = new UniformDataImpl()
    attributeData: AttributeDataImpl = new AttributeDataImpl()

    vert(): Vec4Data {
        let pos: Vec4Data = vec4()
        glSet_V4_V4(pos, vec4_V3_N(this.attributeData.a_position, int_N(1)))
        glSet_V4_V4(pos, glMul_M4_V4(this.uniformData.cc_matViewProj, pos))
        glSet_V2_V2(this.varyingData.uv0, this.attributeData.a_texCoord)
        glSet_V4_V4(this.varyingData.color, this.attributeData.a_color)
        return pos
    }
    main(): void {
        glSet_V4_V4(gl_Position, this.vert())
    }
}
